package com.tianjia.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tianjia.entity.Company;
import com.tianjia.entity.XinWen;
import com.tianjia.entity.XinWenLeiBie;
import com.tianjian.dao.impl.CompanyDaoImpl;
import com.tianjian.dao.impl.XinWenDaoImpl;
import com.tianjian.dao.impl.XinWenLeiBieDaoImpl;

public class NewsServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		int cId = Integer.parseInt(request.getParameter("xinWenId"));
		XinWenDaoImpl xwdao = new XinWenDaoImpl();//创建对象
		List<XinWen> XinWenlist = xwdao.getXinWenList(cId);//通过打点方式,调用方法获得方法对象
		request.setAttribute("XinWenList", XinWenlist);//存数据
		
		XinWenLeiBieDaoImpl xwlb = new XinWenLeiBieDaoImpl();
		List<XinWenLeiBie> xinwenleibie = xwlb.getXinWenLeiBieList();
		request.setAttribute("xinwenleibielist", xinwenleibie);
		
		request.getRequestDispatcher("article_list.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
